package edu.tyut.game.logic.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import edu.tyut.game.logic.model.User

@Dao
interface UserDao {

    @Query("select * from user where id = :id")
    fun getUserByID(id: Int): User

    @Query("select * from user where username = :username and password = :password")
    fun existUser(username: String, password: String): User?

    @Insert
    fun insertAll(vararg users: User)

    @Query("update user set password = :password where username = :username")
    fun updatePassword(username: String, password: String)

    @Query("update user set avatarPath = :avatarPath where id = :uid")
    fun updateHeadIcon(uid: Int, avatarPath: String)
}